#include <bits/stdc++.h>

using namespace std;

int tc = 1, n, cnt[114514];
set<int> s1;
multiset<int> s2, s3;

void dlt(int x) {
    cnt[x]--;
    s2.erase(s2.find(x));
    if (!cnt[x]) {
        s1.erase(x);
    }
}

void slv() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        int x;
        scanf("%d", &x);
        s1.insert(x);
        s2.insert(x);
        cnt[x]++;
    }
    while (!s2.empty()) {
        if (!s3.empty()) {
            multiset<int>::iterator it = s2.upper_bound(*s3.begin());
            if (it != s2.end()) {
                s3.erase(s3.begin());
                s3.insert(*it);
                dlt(*it);
                continue;
            }
        }
        if (s1.size() <= 1) {
            break;
        }
        int x = *s1.begin(), y = *next(s1.begin());
        dlt(x);
        dlt(y);
        s3.insert(y);
    }
    printf("%d", (int)s2.size() + (int)s3.size());
}

int main() {

    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    while (tc--) {
        slv();
    }

    return 0;
}
